//
//  WWLoadingView.m
//  SportsWin
//
//  Created by douniwan on 2019/7/16.
//  Copyright © 2019年 douniwan. All rights reserved.
//

#import "WWLoadingView.h"

@interface WWLoadingView ()

@property (nonatomic, strong) UIActivityIndicatorView *indicatorView;

@end


@implementation WWLoadingView

IMSingletonM(Loading)

#pragma mark - ♻️life cycle
-(instancetype)init{
    if (self = [super init]) {
        [self addSubview:self.indicatorView];
    }
    return self;
}

#pragma mark - 🔄overwrite

#pragma mark - 🚪public

-(void)show{
    [self.indicatorView startAnimating];
    [[UIApplication sharedApplication].keyWindow addSubview:self];
}

-(void)dismiss{
    [self.indicatorView stopAnimating];
    [self removeFromSuperview];
}

#pragma mark - 🍐delegate

#pragma mark - ☎️notification

#pragma mark - 🎬event response

#pragma mark - 🔒private

#pragma mark - 🌲setupUI

#pragma mark - ☸getter and setter
-(UIActivityIndicatorView *)indicatorView{
    if (_indicatorView == nil) {
        _indicatorView = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
        CGFloat x = (SCREEN_WIDTH - 30*ScaleX)/2;
        CGFloat y = (SCREEN_HEIGHT - 30*ScaleX)/2;
        _indicatorView.frame = CGRectMake(x, y, 30*ScaleX, 30*ScaleX);
        _indicatorView.color = [UIColor blackColor];
        _indicatorView.backgroundColor = [UIColor clearColor];
    }
    return _indicatorView;
}





@end
